package com.ctgu.controller;


import com.ctgu.common.ResponseResult;
import com.ctgu.model.entity.Recruit;
import com.ctgu.service.IEmployeeService;
import com.ctgu.service.IRecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yiMa
 * @since 2023-07-05
 */
@RestController
@RequestMapping("/recruit")
public class RecruitController {
    @Autowired
    private IRecruitService recruitService;
    /**
     * 招聘信息分页查询
     * @param page
     * @param pageSize
     * @param name
     * @param require
     * @return
     */
    @GetMapping("/page")
    public ResponseResult page(int page, int pageSize, String name,String require){
        return recruitService.getList(page,pageSize,name,require);
    }

    @PostMapping("/add")
    @PreAuthorize("@AYM.hasAuthority('recruit:one:add')")
    public ResponseResult add_recruit(@RequestBody Recruit recruit){
        return recruitService.add_recruit(recruit);
    }

    @GetMapping("/myPage")
    @PreAuthorize("@AYM.hasAuthority('recruit:info:my')")
    public ResponseResult my_page(int page,int pageSize){
        return recruitService.getMyPage(page,pageSize);
    }

    @DeleteMapping("/delete")
    @PreAuthorize("@AYM.hasAuthority('recruit:list:delete')")
    public ResponseResult delete(@RequestBody Integer[] ids){
        return recruitService.delete(ids);
    }
}

